package services

import (
	"api/libs/errs"
	"api/libs/excel"
	"gitee.com/dreamwood/ez"
	"github.com/xuri/excelize/v2"
	"os"
)

func ExcelImport() {
	root, e := os.Getwd()
	if errs.Try(e) {

		return
	}
	path := root + "/test.xlsx"
	f, e := excelize.OpenFile(path)
	if errs.Try(e) {

		return
	}
	imp := excel.NewImporter()
	imp.File = f
	data := imp.GetPic("C16")
	ez.JsonLog(data)

	//got, raw, e := f.GetPicture("Sheet1", "C16")
	//if errs.Try(e) {
	//
	//	return
	//}
	//if err := os.WriteFile(got, raw, 0644); err != nil {
	//	fmt.Println(err)
	//}
	//ez.Debug(got)
	////ez.JsonLog(raw)
	//ez.JsonLog(got)

	got, e := f.GetCellValue("Sheet1", "F5")
	if errs.Try(e) {

		return
	}
	ez.JsonLog(got)

	t := imp.GetTime("E4")
	ez.JsonLog(t)

}
